//
//  DealsSignApi.m
//  EMMApp
//
//  Created by 无常先生 on 2018/8/30.
//  Copyright © 2018年 YiXun. All rights reserved.
//

#import "DealsSignApi.h"
#define myUrlMethod @"getSignedPage"
#define myUrlPath @"/appapi/getSignedPage"

@implementation DealsSignApi
{
    NSString *_body;
}
- (instancetype) initWithQueryConditions:(NSString *)queryConditions pageNumber:(NSInteger)pageNumber {
    if (self = [super init]) {
        
        NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
        NSString *merchantId = [userdf objectForKey:@"merchantId"];
        NSString *userId = [userdf objectForKey:@"userNameId"];
        NSString *token = [userdf objectForKey:@"is_login"];
        NSString *projectCode = [userdf objectForKey:@"projectCode"];
        NSString *projectId = [userdf objectForKey:@"projectId"];
        
        NSMutableDictionary *params = [NSMutableDictionary dictionary];
        [params setValue:apiVersion forKey:@"version"];
        [params setValue:merchantId forKey:@"merchantId"];
        [params setValue:token forKey:@"token"];
        [params setValue:userId forKey:@"userId"];
        [params setValue:projectId forKey:@"projectId"];
        
        [params setValue:[IDTools devId2] forKey:@"terminalCode"];
        [params setValue:projectCode forKey:@"projectCode"];
        
        [params setValue:queryConditions forKey:@"queryConditions"];
        [params setValue:@(pageNumber) forKey:@"pageNumber"];
        [params setValue:@(10) forKey:@"pageSize"];
        
        _body = [@{@"params" : params} JSONString];
        NSLog(@"----------> %@", _body);
    }
    return self;
}

- (NSString *)requestUrl
{
    return myUrlPath;
}

- (id)requestArgument
{
    return @{ @"body" : _body };
}

- (NSString *)methodString
{
    return myUrlMethod;
}
@end
